package cn.iocoder.yudao.module.system.tcpserver.protocol1;

import cn.iocoder.yudao.module.system.tcpserver.protocol2.NewNettyServer;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class NettyBotter {
    private final NettyServer nettyServer;

    private final NewNettyServer newNettyServer;

    @Bean
    public ApplicationListener<ApplicationReadyEvent> readyEventApplicationListener() {
        return applicationReadyEvent -> {
            try {
                nettyServer.start();
            } catch (Exception e) {
                e.printStackTrace();
            }
            try {
                newNettyServer.start();
            } catch (Exception e) {
                e.printStackTrace();
            }
        };
    }
}
